fix(115_open): refresh OSS STS token during multipart upload#2575
Open
CloudCauldron wants to merge 1 commit into
Open
fix(115_open): refresh OSS STS token during multipart upload#2575CloudCauldron wants to merge 1 commit into
CloudCauldron wants to merge 1 commit into
Conversation
The OSS STS token returned by UploadGetToken expires in about 1 hour. multpartUpload created the OSS client once and never refreshed it, so a slow or large upload running past the token lifetime failed with SecurityTokenExpired and then InvalidAccessKeyId, aborting the transfer. Refresh the token after 45 minutes and rebuild the OSS client with the new credentials, reusing the same multipart upload session (imur) to continue uploading the remaining parts. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 摘要
The 115 Open driver's
multpartUploadobtained the Aliyun OSS STS token once and created the OSS client a single time, never refreshing it during the upload. The STS token expires in ~1 hour, so any single-file upload whose upload phase runs past that window (large files and/or a throttled source) failed withoss: SecurityTokenExpiredand thenInvalidAccessKeyId, aborting the transfer.This refreshes the token after 45 minutes (safe margin under the ~1h lifetime): it calls
UploadGetTokenagain and rebuilds the OSS client/bucket with the new credentials, reusing the same multipart upload session (imur) to continue uploading the remaining parts. The multipart session is identified by bucket + object + uploadId and is not bound to the credentials, so switching credentials mid-upload is valid.Related repository PRs / 关联仓库 PR:
Related Issues / 关联 Issue
N/A — direct fix, no separate tracking issue.
Testing / 测试
go test ./...(未运行完整测试套件)go build ./drivers/115_open/andgo vet ./drivers/115_open/passSecurityTokenExpired→InvalidAccessKeyId; after it, the token is refreshed at 45 minutes and the transfers complete successfully.Checklist / 检查清单
gofmt.AI Disclosure / AI 使用声明
Tools used / 使用工具:
Usage scope / 使用范围:
Code generation / 代码生成
Review assistance / 审查辅助
I have reviewed and validated all AI-assisted content included in this PR.
I have ensured that all AI-assisted commits include
Co-Authored-Byattribution.I can reproduce all AI-assisted content included in this PR without any AI tools.